<!-- templates/base.html -->
{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>{% block title %}AI故事生成器{% endblock %}</title>

    <!-- 引入外部CSS -->
    <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />

    <!-- 可选：引入 Bootstrap CDN 更快 -->
    <!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> -->
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="nav-container">
            <h1><a href="{% url 'create:index' %}" class="logo">✨ StoryGen</a></h1>
            <div class="nav-links">
                <a href="{% url 'create:index' %}" class="nav-link {% if request.resolver_match.url_name == 'index' %}active{% endif %}">首页</a>
                <a href="{% url 'create:generate' %}" class="nav-link {% if request.resolver_match.url_name == 'generate' %}active{% endif %}">生成故事</a>
                {% if user.is_authenticated %}
                    <a href="{% url 'user:profile' %}" class="nav-link {% if request.resolver_match.url_name == 'profile' %}active{% endif %}">个人中心</a>
                    <span class="welcome-text">欢迎，{{ user.nickname|default:user.username }}!</span>
                    <a href="{% url 'user:logout' %}">退出</a>
                {% else %}
                    <a href="{% url 'user:login' %}" class="nav-link {% if request.resolver_match.url_name == 'login' %}active{% endif %}">登录</a>
                    <a href="{% url 'user:register' %}" class="nav-link {% if request.resolver_match.url_name == 'register' %}active{% endif %}">注册</a>
                {% endif %}
            </div>
        </div>
    </nav>

    <!-- 主内容区 -->
    <main class="main-content">
        {% block content %}
        <!-- 子页面内容插入这里 -->
        {% endblock %}
    </main>

    <!-- 页脚 -->
    <footer class="footer">
        <p>&copy; 2025 AI故事生成器. 由通义千问驱动.</p>
    </footer>

    <!-- 引入外部JS -->
    <script src="{% static 'js/main.js' %}"></script>
</body>
</html>